<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-cascades"></i> 审批详情
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="handle-box">

        <el-input v-model='query.aname'  placeholder="审批用户" class="handle-input mr10"></el-input>
        <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
      </div>
      <el-table
          :data="tableData"
          border
          class="table"
          ref="multipleTable"
          header-cell-class-name="table-header"
          @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column prop="aid" label="审批编号" width="55" align="center"></el-table-column>
        <el-table-column prop="aname" label="审批用户"></el-table-column>
          <el-table-column prop="date" type='date' label="审批日期"></el-table-column>
          <el-table-column prop="albname" label="专辑名"></el-table-column>
          <el-table-column prop="remark" label="审批备注">
          </el-table-column>
      </el-table>
      <div class="pagination">
<!--        // layout prev 左箭头 pager 页数 next 右箭头
        //@current-change 页数改变时间 有一个参数 就是当前页数
        //total 条数 会根据总条数和每页显示的条数进行 分页-->
        <el-pagination
            background
            layout="prev, pager, next"
            @current-change="preNext"
            :page-size='pagesize'
            :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: "appdetailtable",
  data() {
    return {
      query: {
        pageNum: 1,
        pageSize: 10
      },
      tableData: [],
      multipleSelection: [],
      delList: [],
      editVisible: false,
      total: 6, pagesize:5,
      idx: -1,
      id: -1,
    };
  },
  created() {
    this.getData();
  },
  methods: {
    // 获取 easy-mock 的模拟数据
    getData() {
        //审批列表
     this.$http({
       url:'http://localhost:8090/approval/selectApproval',
       method:'post',
       params:{pageNum:1,pageSize:5,aname:this.query.aname}
     }).then(response=>{
         //console.log(response)
       //console.log(response)
       this.tableData=response.list
         this.total=response.total
         this.pagesize=response.pageSize
     })
    }, // 触发搜索按钮
    handleSearch() {
      this.$http({
        url:'http://localhost:8090/approval/selectApproval',
        method:'post',
        params:{pageNum:1,pageSize:5,aname:this.query.aname}
      }).then(response=>{
          this.total=response.total
          this.pagesize=response.pageSize
        this.tableData=response.list
      })

    },
      // 多选操作
      handleSelectionChange(val) {
          this.multipleSelection = val;
      },
    delAllSelection() {
    }
      ,
    // 分页导航
    handlePageChange() {
      this.getData();
    },preNext(val){
      this.$http({
        url:'http://localhost:8090/approval/selectApproval',
        method:'post',
        params:{pageNum:val,pageSize:5,aname:this.query.aname}
      }).then(response=>{
          this.total=response.total
          this.pagesize=response.pageSize
        this.tableData=response.list
      })
    }
  }
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}

.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
  display: inline-block;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.mr10 {
  margin-right: 10px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
